// pages/msg_outofstock/msg_outofstock.js
let app = getApp();


Page({

    /**
     * 页面的初始数据
     */
    data: {
        CustomBar: app.globalData.CustomBar,
        tihuoWay: '请选择类型',
        xlk: [
            ['待接单', '已接单'],
            ['0', '1'],
        ],
        storehouse: [{}],
        select: false,
    },
    bindmsg() {
        this.setData({
            select: !this.data.select,
            xlbool: !this.data.xlbool,
        })

    },
    binditem(e) {
        var that = this
        var name = e.currentTarget.dataset.name
        that.setData({
            tihuoWay: name,
            select: !this.data.select,
            xlbool: !this.data.xlbool,
        })
    },
    //时间选择器
    bindDateChangel: function (e) {
        this.setData({
            dateleft: e.detail.value
        })
    },
    bindDateChanger: function (e) {
        this.setData({
            dateright: e.detail.value
        })
    },
    updateData() {

    },
    onLaunch:function (){
    
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        let that = this
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        var lw = new Date(date - 1000 * 60 * 60 * 24 * 30); //最后一个数字30可改，30天的意思
        var lastY = lw.getFullYear();
        var lastM = lw.getMonth() + 1;
        var lastD = lw.getDate();
        var startdate = lastY + "-" + (lastM < 10 ? "0" + lastM : lastM) + "-" + (lastD < 10 ? "0" + lastD : lastD); //三十天之前日期
        if (month < 10) {
            month = "0" + month;
        }
        if (day < 10) {
            day = "0" + day;
        }
        var dateright = year + "-" + month + "-" + day;

        that.setData({
            dateright: dateright
        })
        that.setData({
            dateleft: startdate
        })
       

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {
       
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        let that = this
        var query = wx.createSelectorQuery();
        query.select('.box_show').boundingClientRect(function (rect) {
            // console.log(rect.width)
            that.setData({
                height: rect.height
            })
        }).exec();
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})